package com.lfg.leetcode.leetcode0;

public class No26RemoveDuplicates {

    public static int removeDuplicates(int[] array) {

        int j = 0;
        for (int i = 0; i < array.length; i++) {
            int e = array[i];
            if (array[j] == e) {
                continue;
            }
            if (i != j) {
                array[j] = e;
            }
            j++;
        }
        return j;
    }

    public static void main(String[] args) {
        int l = removeDuplicates(new int[]{1, 1, 2});
        System.out.println(l);
    }
}

